<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>通过阴影来弱化背景</title>
    <style>
        .bg{
            position: fixed;
            width: 100vw;
            height: 100vh;
            top: 0;
            left: 0;
            background-image: url(./img/7.webp);
            background-size: cover;
        }
        /* 负责将背景变暗 */
        .overlay{
            position: fixed;
            width: 100vw;
            height: 100vh;
            top: 0;
            left: 0;
            background-color: rgba(0, 0, 0, .8);
        }
        .overlay>img{
            position: absolute;
            z-index: 1;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
    </style>
</head>

<body>
    <div class="bg"></div>
    <div class="overlay">
        <img src="./img/8.webp" alt="">
    </div>
</body>

</html>